package com.cf.controller;

import com.cf.entity.ItemMan;
import com.cf.entity.Result;
import com.cf.service.ItemManService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.CrossOrigin;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import java.util.Date;

/**
 * @author 59899
 */
@RestController
@CrossOrigin
public class ItemManController {

    @Autowired
    private ItemManService itemManService;

    @RequestMapping("/addOtherMessToItemMan")
    public Object addOtherMessToItemMan(ItemMan itemMan, long iid){
        int i = itemManService.addOtherMessToItemMan(itemMan, iid);
        if (i!=0){
            return new Result(200,"添加成功",null);
        }else {
            return new Result(400,"添加失败",null);
        }
    }

    @RequestMapping("/selectItemManByIid")
    public Object selectItemManByIid(long iid){
        ItemMan itemMan = itemManService.selectItemManByIid(iid);
        if (itemMan!=null){
            return new Result(200,"添加成功",itemMan);
        }else {
            return new Result(400,"添加失败",null);
        }
    }

}
